import {attr} from '@/api/index'
const state = {  
    // 定义存储商品数据的数组
     attrList:[],
    //  存储三级分类列表的id
    category3Id:'',
}
const mutations = {
    GET_ATTRLIST(state,attrList){
        state.attrList = attrList
    },
    CLEAR_LIST(state){
        state.attrList = []
    }
}
const actions ={
    // 获取商品分类列表
    async getAttrList ({commit},id){
        // console.log(id);
        // console.log(attr);
      let result = await attr.reqGetAttrList(id)
    //   console.log(result.data);
        commit('GET_ATTRLIST',result.data)
    },
    clearList({commit}){
      commit('CLEAR_LIST')
    }
}
const getters  = {

}
export default {
    state,mutations,actions,getters
}